home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr45 / mdidmo.zip / MDILOGO.FRM < prev    next >
Text File  |  1994-04-12  |  7KB  |  242 lines

  1. VERSION 2.00
  2. Begin MDIForm frmMain 
  3.    Caption         =   "MDI Background Demo"
  4.    ClientHeight    =   5190
  5.    ClientLeft      =   1095
  6.    ClientTop       =   1770
  7.    ClientWidth     =   9210
  8.    Height          =   5880
  9.    Left            =   1035
  10.    LinkTopic       =   "MDIForm1"
  11.    Top             =   1140
  12.    Width           =   9330
  13.    Begin SSPanel pStatus 
  14.       Align           =   2  'Align Bottom
  15.       BevelInner      =   1  'Inset
  16.       Caption         =   "pStatus"
  17.       Font3D          =   3  'Inset w/light shading
  18.       Height          =   405
  19.       Left            =   0
  20.       TabIndex        =   9
  21.       Top             =   4785
  22.       Width           =   9210
  23.    End
  24.    Begin SSPanel Panel3D1 
  25.       Align           =   1  'Align Top
  26.       Height          =   525
  27.       Left            =   0
  28.       TabIndex        =   8
  29.       Top             =   0
  30.       Width           =   9210
  31.       Begin OptionButton FocusTrap 
  32.          BackColor       =   &H00C0C0C0&
  33.          Caption         =   "Option1"
  34.          Height          =   255
  35.          Left            =   8820
  36.          TabIndex        =   0
  37.          Top             =   150
  38.          Value           =   -1  'True
  39.          Width           =   225
  40.       End
  41.       Begin CommandButton cButton 
  42.          Caption         =   "Show All"
  43.          Height          =   345
  44.          Index           =   5
  45.          Left            =   6150
  46.          TabIndex        =   6
  47.          Tag             =   "Unhide all ""hidden"" child document forms"
  48.          Top             =   90
  49.          Width           =   1215
  50.       End
  51.       Begin CommandButton cButton 
  52.          Caption         =   "Vertical"
  53.          Height          =   345
  54.          Index           =   4
  55.          Left            =   4950
  56.          TabIndex        =   5
  57.          Tag             =   "Tile vertically all ""visible"" document child forms"
  58.          Top             =   90
  59.          Width           =   1215
  60.       End
  61.       Begin CommandButton cButton 
  62.          Caption         =   "Exit"
  63.          Height          =   345
  64.          Index           =   6
  65.          Left            =   7350
  66.          TabIndex        =   7
  67.          Tag             =   "Exit demonstration"
  68.          Top             =   90
  69.          Width           =   1215
  70.       End
  71.       Begin CommandButton cButton 
  72.          Caption         =   "Horizontal"
  73.          Height          =   345
  74.          Index           =   3
  75.          Left            =   3750
  76.          TabIndex        =   4
  77.          Tag             =   "Tile horizontally all ""visible"" document child forms"
  78.          Top             =   90
  79.          Width           =   1215
  80.       End
  81.       Begin CommandButton cButton 
  82.          Caption         =   "Cascade"
  83.          Height          =   345
  84.          Index           =   2
  85.          Left            =   2550
  86.          TabIndex        =   3
  87.          Tag             =   "Cascade all ""visible"" child document forms"
  88.          Top             =   90
  89.          Width           =   1215
  90.       End
  91.       Begin CommandButton cButton 
  92.          Caption         =   "New"
  93.          Height          =   345
  94.          Index           =   1
  95.          Left            =   1350
  96.          TabIndex        =   2
  97.          Tag             =   "Create new instance of document child form"
  98.          Top             =   90
  99.          Width           =   1215
  100.       End
  101.       Begin CommandButton cButton 
  102.          Caption         =   "Background"
  103.          Height          =   345
  104.          Index           =   0
  105.          Left            =   150
  106.          TabIndex        =   1
  107.          Tag             =   "Toggle between MDI backgrounds"
  108.          Top             =   90
  109.          Width           =   1215
  110.       End
  111.    End
  112.    Begin Menu mMain 
  113.       Caption         =   "&Parent Menu"
  114.       Begin Menu mTest 
  115.          Caption         =   "E&xit"
  116.       End
  117.    End
  118. End
  119. '---------------------------------------------------------------------------
  120. ' MDI Background Demo Program, Copyright (c) 1994 Karl E. Peterson
  121. ' Redistributed by permission.    CompuServe: 72302,3707
  122. ' See MDILOGO.BAS for complete description
  123. '---------------------------------------------------------------------------
  124.  
  125. 'Default behavior
  126.   DefInt A-Z
  127.   Option Explicit
  128.  
  129. 'Index into toolbar buttons
  130.   Const bBackground = 0
  131.   Const bNew = 1
  132.   Const bCascade = 2
  133.   Const bHorz = 3
  134.   Const bVert = 4
  135.   Const bShow = 5
  136.   Const bExit = 6
  137.  
  138. Sub cButton_Click (Index As Integer)
  139.   
  140.   FocusTrap.SetFocus
  141.   Select Case Index
  142.     Case bBackground
  143.       'Increment current background
  144.       frmLogo!HiddenSwitch = Val(frmLogo!HiddenSwitch) + 1
  145.       
  146.     Case bNew
  147.       mdiNew
  148.  
  149.     Case bCascade
  150.       mdiArrange WM_MDICASCADE
  151.  
  152.     Case bHorz
  153.       mdiArrange MDITILE_HORIZONTAL
  154.  
  155.     Case bVert
  156.       mdiArrange MDITILE_VERTICAL
  157.  
  158.     Case bShow
  159.       mdiShowAll
  160.     
  161.     Case bExit
  162.       mdiShowAll
  163.       Unload Me
  164.  
  165.   End Select
  166.   
  167. End Sub
  168.  
  169. Sub cButton_MouseMove (Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  170.   'Update status bar
  171.     DisplayStatus (cButton(Index).Tag)
  172. End Sub
  173.  
  174. Sub MDIForm_Load ()
  175.   
  176.   'Position form on screen, use 640x480 as target dims
  177.     Dim newWidth%, newHeight%
  178.     newWidth = 640 * Screen.TwipsPerPixelX
  179.     If Screen.Height > 480 * Screen.TwipsPerPixelY Then
  180.       newHeight = 480 * Screen.TwipsPerPixelY
  181.     Else
  182.       newHeight = .9 * Screen.Height
  183.     End If
  184.     Move (Screen.Width - newWidth) \ 2, (Screen.Height - newHeight) \ 2, newWidth, newHeight
  185.     FocusTrap.Move FocusTrap.Width * -3
  186.  
  187.   'Set up child arrays
  188.     ReDim fDoc(1)    'array of child forms
  189.     ReDim fState(1)  'array to track child state
  190.   
  191.   'Create first child, position it, and clear status bar
  192.     mdiNew
  193.     cButton_Click bCascade
  194.     DisplayStatus ""
  195.  
  196. End Sub
  197.  
  198. Sub MDIForm_Resize ()
  199.   
  200.   If Me.WindowState <> MINIMIZED Then
  201.     'rearrange icons
  202.       mdiArrange WM_MDIICONARRANGE
  203.     'Reposition background form
  204.       Dim cWnd%, R As Rect
  205.       cWnd = GetWindow(Me.hWnd, GW_CHILD)
  206.       Call GetClientRect(cWnd, R)
  207.       frmLogo.Move 0, 0, R.Right * Screen.TwipsPerPixelX, R.Bottom * Screen.TwipsPerPixelY
  208.       'Dim hFluff%, wFluff%
  209.       'hFluff = (2 * GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYBORDER) + GetSystemMetrics(SM_CYMENU)) * Screen.TwipsPerPixelY
  210.       'wFluff = GetSystemMetrics(SM_CXFRAME) * 2 * Screen.TwipsPerPixelX
  211.       'frmLogo.Move 0, 0, Me.Width - wFluff, Me.Height - hFluff
  212.   End If
  213.  
  214. End Sub
  215.  
  216. Sub MDIForm_Unload (Cancel As Integer)
  217.  
  218.   Dim i%, Ret%
  219.   For i = Forms.Count - 1 To 0 Step -1
  220.     If Forms(i) Is Me Then
  221.       'do nothing
  222.     Else
  223.       'If IsWindowVisible(Forms(i).hWnd) = False Then
  224.       '  Ret% = ShowWindow(fDoc(i).hWnd, SW_SHOWNA)
  225.       'End If
  226.       Unload Forms(i)
  227.     End If
  228.   Next i
  229.  
  230. End Sub
  231.  
  232. Sub mTest_Click ()
  233.   'This routine will *never* be called!
  234.     Unload Me
  235. End Sub
  236.  
  237. Sub Panel3D1_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  238.   'Update status bar
  239.     DisplayStatus ""
  240. End Sub
  241.  
  242.